#include <stdio.h>

int gcd(int a, int b)
{
    int r;
    while (r = a % b)
    {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    int w, h;
    while (scanf("%d %d", &w, &h) == 2 && !(w == 0 && h == 0))
    {
        int g = gcd(w, h);
        printf("%lld\n", (long long)(w / g) * (long long)(h / g));
    }
    return 0;
}